﻿@model IPagedList<Infinity.Models.Instructor>

@{
    ViewBag.Title = "Index";
    Layout = "~/Areas/Managerial/Views/Shared/_AdminLayout.cshtml";
}
@using PagedList;
@using PagedList.Mvc;
<h2>Index</h2>

<p>
</p>
<p>
    @using (Html.BeginForm("Index", "Instructor", FormMethod.Get))
    {                                                                           
        <b>Seaech By:</b> @Html.RadioButton("searchBy", " Name", true) <text> Name</text>
       
        @Html.RadioButton("searchBy", " Mail") <text> Mail</text>
                     
        <br />
         
        @Html.TextBox("search") <input type="submit" value="Search"  class="submit"/>
    }

</p>
<div id="InstructorContainer">
    <table>
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.First().InsructorID)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.First().Name)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.First().Phone)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.First().Address)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.First().Mail)
            </th>
            <th></th>
        </tr>

        @foreach (var item in Model)
        {
            using (Html.BeginForm("Delete", "Instructor", new { id = item.InsructorID }))
            {
<tr>
        <td>
            @Html.DisplayFor(modelItem => item.InsructorID)
                </td>
        <td>
            @Html.DisplayFor(modelItem => item.Name)
                </td>
        <td>
            @Html.DisplayFor(modelItem => item.Phone)
                </td>

        <td>
            @Html.DisplayFor(modelItem => item.Address)
                </td>
        <td>
            @Html.DisplayFor(modelItem => item.Mail)
                </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id = item.InsructorID }, new { @class = "buttonstyle" }) |
                @*            <button class=" buttonstyle del" value="@item.InsructorID"  id="DeleteInstructor">Delete</button>*@
                @*            @Html.ActionLink("Delete", "Delete", new { id = item.InsructorID }, new { @class = "buttonstyle" })*@

            <input type="submit" value="Delete" class="buttonstyle" onclick="return confirm('Are you sure you  want to delete This')"; />
            
            
        </td>
    </tr>
            }
        }


    </table>


    <table>
        <tr>
            <td>@Html.PagedListPager(Model, page => Url.Action("Index", new { page, searchBy = Request.QueryString["searchBy"], search = Request.QueryString["search"] }))</td>

            <td>&nbsp;&nbsp; @Html.ActionLink("Create New Instructor", "Create", null, new { @class = "buttonstyle" })</td>
        </tr>
    </table>
</div>
